package com.blackcat.v1.valves;



import com.blackcat.v1.Request;
import com.blackcat.v1.Response;
import com.blackcat.v1.Valve;
import com.blackcat.v1.ValveContext;
import lombok.extern.slf4j.Slf4j;

import javax.servlet.ServletException;
import java.io.IOException;

@Slf4j
public class HeaderValve implements Valve {

    public String getInfo() {
        return this.getClass().getName();
    }

    public void invoke(Request request, Response response, ValveContext context) throws IOException, ServletException {
        log.info("[{}] before invoke",getInfo());
        context.invokeNext(request,response);
        log.info("after invoke  [{}]",getInfo());
    }
}
